import { createRouter, createWebHistory } from 'vue-router'
import main from "../views/main";
import about from "../views/about";
import courses from "../views/courses";
import disscussIndex from "../views/disscussIndex";
import Discuss_list from "../components/discuss_list";
import disscuss_detail from "../components/disscuss_detail";
import homework from "../views/homework";
import sign from "../views/sign";
import testText from "../views/testText";
import userInfo from "../views/userInfo";
import courseList from "../components/courseList";
import couresDetail from "../components/couresDetail";
import CurriculumDetail from "../components/CurriculumDetail";
import homeWorkDetail from "../components/homeWorkDetail";
import homeWorkList from "../components/homeWorkList";


const routes = [
  {
    path: '/',
    redirect: '/index'
  },
  {
    path: '/index',
    name: 'Index',
    component: main
  },
  {
    path: '/about',
    name: 'about',
    component: about
  },
  {
    path: '/courses',
    name: 'courses',
    component: courses,
    children:[
      {
        path: '',
        name: 'courseList',
        component: courseList
      },
      {
        path: 'courseDetail',
        name: 'courseDetail',
        component: couresDetail
      },
      {
        path: 'CurriculumDetail',
        name: 'CurriculumDetail',
        component: CurriculumDetail
      },

    ]
  },
  {
    path: '/discuss',
    name: 'discuss',
    component: disscussIndex,
    children: [
      {
        path: 'DisscussList',
        name: 'DisscussList',
        component: Discuss_list
      },
      {
        path: 'disscussDetail',
        name: 'disscussDetail',
        component: disscuss_detail
      },
    ]
  },
  {
    path: '/homework',
    name: 'homework',
    component: homework,
    children: [
      {
        path: 'homeWorkDetail',
        name: 'homeWorkDetail',
        component: homeWorkDetail,
      },
      {
        path: '',
        name: 'homeWorkList',
        component: homeWorkList,
      }
    ]
  },
  {
    path: '/sign',
    name: 'sign',
    component: sign
  },
  {
    path: '/testText',
    name: 'testText',
    component: testText
  },
  {
    path: '/userInfo',
    name: 'userInfo',
    component: userInfo
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
